package com.dangdang.action.order;

import java.util.List;

import com.dangdang.action.BaseAction;
import com.dangdang.domain.ReceiveAddress;
import com.dangdang.domain.User;
import com.dangdang.service.ServiceFactory;
import com.dangdang.service.UserService;
import com.dangdang.util.Constants;

/**
 * 获得收货人收货地址
 * 
 * @author Wangpeihu
 * @team [Never give up]
 * @since JDK1.6(建议)
 * @date 2010-1-29
 */
public class ReceiveAddressAction extends BaseAction {

	private List<ReceiveAddress> receiveAddressList;

	private UserService us;

	/**
	 * 
	 * @return
	 */
	public String getAddress() {
		us = ServiceFactory.getUserService();
		User user = (User) session.get(Constants.USER_KEY);
		receiveAddressList = us.findAddressByUserId(user.getId());
		session.put("receiveAddressList", receiveAddressList);
		return Constants.FORWARD_SUCCESS;
	}

	/**
	 * 
	 * @return
	 */
	public String execute() {
		return Constants.FORWARD_SUCCESS;
	}

	public List<ReceiveAddress> getAddressList() {
		return receiveAddressList;
	}

	public void setAddressList(List<ReceiveAddress> receiveAddressList) {
		this.receiveAddressList = receiveAddressList;
	}
}
